package com.xh.bussiness.exam.service;

import com.xh.bussiness.exam.bean.ErrorClassStudent;
import com.xh.bussiness.exam.bean.dto.*;
import com.xh.bussiness.exam.bean.request.StudentErrorTotalStatRequest;
import com.xh.bussiness.exam.bean.request.UserErrorQuestionRequest;
import com.xh.bussiness.exam.bean.request.UserErrorQuestionSaveRequest;
import com.xh.bussiness.exam.model.UserErrorQuestion;
import com.xh.core.bean.XhPage;
import com.xh.core.service.IBaseService;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/*
 * @Author daiwei
 * @Description
 * @Date 2019/4/16 14:58
 **/
public interface IUserErrorQuestionService extends IBaseService<UserErrorQuestion> {

    /**
     * 新增错题本数据
     * @param bean
     * @return
     */
    List<String> addUserErrorQuestion(UserErrorQuestionSaveRequest bean);

    /**
     * 通过学生ID和试题ID查询错题详情
     * @param studentId
     * @param questionId
     * @return
     */
    UserErrorQuestion queryUserErrorQuestionByStuIdAndQuesId(String studentId, String questionId);

    /**
     * 查询学生错题知识点
     * @param studentId
     * @param subjectId
     * @param gradeId
     * @return
     */
    List<StuErrorQuesKnowledgePointTreeDto> queryStudentErrorQuesKnowledge(String studentId, String subjectId, String gradeId);


    List<UserErrorQuestion> queryUserErrorQuestion(UserErrorQuestionRequest bean);

	XhPage<UserErrorQuestionDto> queryUserErrorQuestionPage(XhPage<UserErrorQuestionDto> page,
			UserErrorQuestionRequest bean);

	List<Map<String, Object>> queryCountBySubject(String userId);

    /**
     * 根据年月日查询错题个数
     * @param studentId
     * @param year
     * @param month
     * @return
     */
    List<Map<String, Object>> queryCountByCalendar(String studentId, Integer year, Integer month);


    /**
     * 学员错题汇总统计
     * @return
     */
    StudentErrorTotalStatDto queryStudentErrorTotalStat(StudentErrorTotalStatRequest request);

    /**
     * 根据日期查询错题列表
     * @param studentId
     * @param date [yyyy-MM-dd]
     * @return
     */
    XhPage<UserErrorQuestionDto> queryStuErrorQuestionIdByDate(XhPage page,String studentId, String date);

    /**
     * 查询学生错题详情
     * @param userErrorQuestionId
     * @return
     */
    UserErrorQuestionDetailsDto queryUserErrorQuestionDetail(String userErrorQuestionId);

    /**
     * 小程序学生端统计报告
     * @param studentId
     * @return
     */
    StudentReportForAppletDto queryStudentReportForApplet(String studentId);

    /**
     * 统计学生已订正错题数
     * @param studentId
     * @return
     */
    Integer queryCorrectCountByStuId(String studentId,Integer status);

    XhPage queryByPaperId(XhPage<UserErrorQuestionDto> page, String paperId, String studentId);


    Integer queryStudentErrorQuesCountByLwStudentId(String lwStudentId);

    UserErrorQuestion checkUserErrorQuestion(UserErrorQuestionRequest request);

    void cancelUserErrorQuestion(String[] ids);

    /**
     * 按班级或学生查询错题
     * @author 赵文博
     * @date 2021/5/14 9:51
     * @param page
     * @param bean
     * @return java.util.List<com.xh.bussiness.exam.bean.dto.UserErrorQuestionDto>
     **/
    XhPage<UserErrorQuestionDto> queryErrorQuestion(XhPage<UserErrorQuestionDto> page,UserErrorQuestionRequest bean);

    /**
     * 查询错某道题的学生
     * @author 赵文博
     * @date 2021/5/14 9:52
     * @param bean
     * @return java.util.List<com.xh.bussiness.exam.bean.ErrorClassStudent>
     **/
    List<ErrorClassStudent> queryErrorStudent(UserErrorQuestionRequest bean);
}
